<template>
  <el-input :value='row[$attrs.colName]' size='mini'  @input="handleChangeInputList" :readonly="$attrs.readonly" @change="numberChange"></el-input>
</template>

<script type="text/javascript">
  define(['vue'],function(vue){
    return vue.component('comp-table-text',{
      props:['row','index'],
      data : function() {
        return {
        };
      },
      template: template,
      methods : {
        handleChangeInputList : function(newVal) {
          this.row[this.$attrs.colName] = newVal;
          this.$forceUpdate();
          this.numberChange();
        },
        numberChange:function(){
          this.row.moneyinvoice = this.toDecimal(this.row.priceinvoice*this.row.cnt)||0;
          this.row.money_noinvoice = this.toDecimal(this.row.price_noinvoice*this.row.cnt)||0;
          this.row.moneyinvoice = parseFloat(this.row.moneyinvoice||0);
          this.row.money_noinvoice = parseFloat(this.row.money_noinvoice||0);
          this.$forceUpdate();
        },
        toDecimal : function(x) {
          var f = parseFloat(x);
          if (isNaN(f)) {
              return x;
          }
          f = Math.round(x*100)/100;
          return f;
        }
      }
    });
  });
</script>

<style>
</style>